﻿@using ThuySan.Areas.Backend.Models
@using ThuySan.Models
@model ThuySan.Models.SettingModel
@{
    Layout = "~/Areas/Backend/Views/Shared/_Layout.cshtml";
    Header header = new Header
    {
        Common = "ViewUserControl_Setting_Edit",
        CurentCommon = "Setting",
        PageHeader = "Edit Setting",
        Menulv1 = "02",
        Menulv2 = "0201"
    };
    ViewData[Header.Key] = header;
    ViewBag.Title = "Edit Setting - Admin Control Panel";
    Html.EnableClientValidation();
}
<div class="content-box">
    <div class="content-box-header">
        <h3>
            Edit Setting</h3>
    </div>
    <div class="content-box-content">
        @using (Html.BeginForm("Edit", "Setting", FormMethod.Post, new
        {
            enctype = "multipart/form-data"
        }))
        {
            @Html.HiddenFor(c => c.SettingId)
            @Html.HiddenFor(c => c.IsUpload)
            @Html.ValidationMessage("error")
            <div class="input-item">
                <label>
                    Name</label>
                @Html.TextBoxFor(c => c.Name, new
           {
               @class = "text-input medium-input"
           })
                @Html.ValidationMessageFor(c => c.Name)
            </div>
            <div class="input-item">
                <label>
                    Description</label>
                @Html.TextAreaFor(c => c.Description, new
           {
               @class = "text-input large-input"
           })
            </div>
            <div class="input-item">
                <label>
                    Value</label>
                @{
            if (Model.IsUpload)
            {
                    @Html.HiddenFor(c => c.Value)
                if (!string.IsNullOrEmpty(Model.Value))
                {
                    <img src="@Html.UploadPath("Setting")@Model.Value" width="200" />
                    <br />
                }
                    <input type="file" name="thumbnail" id="thumbnail" />
            }
            else
            {
                    @Html.TextBoxFor(c => c.Value, new
                   {
                       @class = "text-input medium-input"
                   })
            }
                }
                @Html.ValidationMessageFor(c => c.Value)
            </div>
            <input type="submit" value="Update" class="button" />
            <input type="button" onclick="javascript:window.location.href='@Url.Action("Index")';" value="Reset" class="button" />
        }
    </div>
</div>
